Fix CI: JUnit NU1102 + telemetry tests post-{asm}_{tfm}_{arch} default#9010
Fix CI: JUnit NU1102 + telemetry tests post-{asm}_{tfm}_{arch} default#9010Evangelink wants to merge 2 commits into
Conversation
…sting.Platform The MSTestJUnitReportRetry and MSTestJUnitReportMTPRetry generated test-asset csprojs reference the MSTest metapackage which transitively pulls Microsoft.Testing.Extensions.CodeCoverage (>= 18.9.0-preview.X.Y from the public NuGet feed). CodeCoverage in turn requires Microsoft.Testing.Platform with the exact preview build label minted by Versions.props, which is not available on public NuGet feeds. NuGet then fails restore with NU1102 because no feed satisfies that range. Mirror the pattern used by TrxReportTests and AbortionTests: add an explicit top-level PackageReference to Microsoft.Testing.Platform with the locally packed version so NuGet uses the local Shipping artifact instead of trying to resolve the transitive request. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes NU1102 restore failures in newly added MSTest acceptance tests for the JUnitReport extension by ensuring the generated test-asset projects explicitly reference Microsoft.Testing.Platform at the locally-packed version, preventing NuGet from trying (and failing) to satisfy transitive preview constraints from public feeds.
Changes:
- Add a top-level
PackageReferencetoMicrosoft.Testing.Platformin the generated csproj for the[Retry]-attribute JUnit scenario. - Add a top-level
PackageReferencetoMicrosoft.Testing.Platformin the generated csproj for the MTP--retry-failed-testsorchestrator scenario.
Show a summary per file
| File | Description |
|---|---|
test/IntegrationTests/MSTest.Acceptance.IntegrationTests/JUnitReportTests.cs |
Pins Microsoft.Testing.Platform in both generated test-asset projects to avoid NU1102 restore failures caused by transitive preview version constraints. |
Copilot's findings
- Files reviewed: 1/1 changed files
- Comments generated: 0
Evangelink
left a comment
There was a problem hiding this comment.
Note
🤖 Automated review by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review workflow. To request a follow-up action, reply by tagging @copilot directly.
✅ 22/22 dimensions clean — no findings.
Review summary:
The fix correctly addresses the root cause. By adding an explicit top-level <PackageReference Include="Microsoft.Testing.Platform" Version="$MicrosoftTestingPlatformVersion$" /> to each generated test-asset csproj, NuGet satisfies the transitive Microsoft.Testing.Platform >= 2.3.0-preview.X constraint using the locally-packed Shipping artifact rather than trying (and failing) to resolve a preview build from public feeds.
Key validations:
- Pattern consistency: mirrors
TrxReportTests.cs(lines 72, 182),AbortionTests.cs(line 54),MaxFailedTestsExtensionTests.cs, and several others. - Placeholder substitution:
$MicrosoftTestingPlatformVersion$is already patched via.PatchCodeWithReplace("$MicrosoftTestingPlatformVersion$", MicrosoftTestingPlatformVersion)in bothGetAssetsToGenerate()implementations (lines 87 and 218 respectively), sourced from the local shipping artifacts viaExtractVersionFromPackage. - Placement: both new references appear before the
MSTestmetapackage reference, which is the correct top-level override position for NuGet. - Scope: exactly two lines added, no unrelated changes.
🤖 Automated content by GitHub Copilot. Posted via a maintainer's GitHub token, so it appears under their account — the account owner did not write or approve this content personally. Generated by the Expert Code Review (on PR ready) workflow.{ai_credits_suffix} · ◷
🧪 Test quality grade — PR #9010No new or modified test methods were identified in the changed regions The two changed lines (in Re-run with
|
… diag prefix PR #8971 changed the default diagnostic file prefix from 'log' to '{asm}_{tfm}_{arch}' but missed updating the telemetry acceptance tests, which still expected files matching 'log_*.diag'. Mirror the BuildDefaultDiagnosticFilePathPattern helper introduced in DiagnosticTests.cs and use it in both the MTP and MSTest telemetry acceptance test files. Fixes pipeline build 2996915 telemetry acceptance test failures: - Telemetry_ByDefault_TelemetryIsEnabled - Telemetry_WhenOptingOutTelemetry_WithEnvironmentVariable_TelemetryIsDisabled - Telemetry_WhenOptingOutTelemetry_With_DOTNET_CLI_EnvironmentVariable_TelemetryIsDisabled - Telemetry_WhenEnableTelemetryIsFalse_WithTestApplicationOptions_TelemetryIsDisabled - MTP_RunTests_SendsTelemetryWithSettingsAndAttributes - MTP_DiscoverTests_SendsTelemetryEvent - MTP_WhenTelemetryDisabled_DoesNotSendMSTestEvent Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes failures on internal pipeline build 2996915:
1. JUnit retry acceptance fixtures (original scope)
Restore tests were failing with NU1102 because the generated csproj fixtures pulled in a Microsoft.Testing.Platform version that no longer resolves. Pin the package version to the one shipped from the current build.
2. Telemetry acceptance tests (new)
PR #8971 changed the default diagnostic file prefix from
logto{asm}_{tfm}_{arch}but missed updating the telemetry acceptance tests, which still expected files matchinglog_*.diag.Mirror the
BuildDefaultDiagnosticFilePathPatternhelper introduced inDiagnosticTests.csand use it in both:test/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryTests.cstest/IntegrationTests/Microsoft.Testing.Platform.Acceptance.IntegrationTests/TelemetryDisabledTests.cstest/IntegrationTests/MSTest.Acceptance.IntegrationTests/TelemetryTests.csTests verified locally on Windows / net11.0: